import Vue from 'vue'
import Vuex from 'vuex'
import menu from './modules/menu'
import url from './modules/url'
import map from './modules/map'
import VuexPersistense  from 'vuex-persistedstate'
/* 
vuex 数据持久化 
1. 依赖下载  npm install vuex-persistedstate -S
2. import VuexPersisted  from 'vuex-persistedstate'
*/
Vue.use(Vuex)

const vuexLocal = new VuexPersistense({
  storage: localStorage,
  reducer: val => {
    //这里加上需要持久化的数据
    return {
      map:{
        windowsInfo: val.map.windows
      }
    }
  }
})


export default new Vuex.Store({
  modules: {
    menu,
    url,
    map,
  },
  plugins: [vuexLocal]
})
